/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (almaslvl@gmail.com).
 * See LICENSE for details.
 */

package com.windea.study.kotlin.fxgl.sample.sandbox

import com.almasb.fxgl.app.*
import com.almasb.fxgl.core.math.*
import com.almasb.fxgl.dsl.*
import com.almasb.fxgl.dsl.FXGL.Companion.setLevelFromMap
import com.almasb.fxgl.ui.*
import java.util.*

/**
 * Shows how to init a basic game object and attach it to the world
 * using fluent API.
 *
 * @author Almas Baimagambetov (AlmasB) (almaslvl@gmail.com)
 */
class TiledMapSample : GameApplication() {
	
	// 1. define types of entities in the game using Enum
	private enum class Type {
		PLAYER, NPC
	}
	
	override fun initSettings(settings: GameSettings) {
		settings.width = 800
		settings.height = 600
		settings.title = "TiledMapSample"
		settings.version = "0.1"
	}
	
	override fun initGameVars(vars: MutableMap<String, Any>) {
		vars["someInt"] = 0
		vars["someDouble"] = 0.0
		vars["someVec2"] = Vec2(15.0, 33.0)
		vars["someString"] = "Hello FXGL World"
	}
	
	override fun initGame() {
		getGameWorld().addEntityFactory(MyEntityFactory())
		
		val level = setLevelFromMap("tmx/map_with_gid_objects.tmx")
		
		val map = HashMap<String, Int>()
		map["h"] = 1
		map["kjj"] = 2
		
		println(map)
		
		println(level.properties)
		
		//        Level level = getAssetLoader().loadLevel("tmx/map_with_gid_objects.tmx", new TMXLevelLoader());
		//
		//        getGameWorld().setLevel(level);
		
		addUINode(FXGLCheckBox(), 200.0, 400.0)
	}
}

fun main(args: Array<String>) {
	GameApplication.launch(TiledMapSample::class.java, args)
}
